<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        li {
            list-style-type: none;
        }
        
        a {
            text-decoration: none;
            font-size: 14px;
        }
        
        .nav {
            margin: 100px;
        }
        
        .nav>li {
            position: relative;
            float: left;
            width: 120px;
            height: 41px;
            text-align: center;
			box-sizing: border-box;
			margin-right:30px;
        }
        
        .nav li a {
            display: block;
            width: 100%;
            height: 100%;
            line-height: 41px;
            color: #333;
			font-family: "microsoft yahei";
        }
        
        .nav>li>a:hover {
            background-color: #2c63ff;
			color:#fff;
        }
        
        .nav ul {
            display: none;
            position: absolute;
            top: 41px;
            left: 0;
            width: 100%;
            border-left: 1px solid #4071fe;
            border-right: 1px solid #4071fe;
			border-bottom: 1px solid #4071fe;
			width: 120px;
			box-sizing: border-box;
        }
        .nav ul li a:hover {
            background-color: #2c63ff;
			color:#fff;
        }
    </style>
	<!-- 导入jquery库 -->
    <script src="js/jquery2.1.4.min.js"></script>
</head>

<body>
    <ul class="nav">
        <li>
            <a href="#">网页特效</a>
            <ul>
                <li>
                    <a href="">文字特效</a>
                </li>
                <li>
                    <a href="">瀑布流</a>
                </li>
                <li>
                    <a href="">选项卡</a>
                </li>
            </ul>
        </li>
        <li>
            <a href="#">HTML5&CSS3</a>
            <ul>
                <li>
                    <a href="">HTML实例</a>
                </li>
                <li>
                    <a href="">CSS3实例</a>
                </li>
            </ul>
        </li>
    </ul>
	<script type="text/javascript">
		$(function(){
			console.log('页面加载完成...');
			console.log($('.nav >li'));
			/*
 			$('.nav>li').mouseover(function(){
				//让li里面的ul下拉框显示
				$(this).children('ul').show('slow');
			});
			$('.nav>li').mouseout(function(){
				//让li里面的ul下拉框显示
				$(this).children('ul').hide('slow');
			}); 
			*/
			//mouseover和mouseout
			//hover它是mouseover和mouseout的综合
			//$('.nav>li').hover(function(){},function(){});
			//stop()停止动画，一般放在动画的前面
			/* 
			$('.nav>li').hover(function(){
				//相当于mouseover
				$(this).children('ul').stop().slideDown('slow');
			},function(){
				//相当于mouseout
				$(this).children('ul').stop().slideUp('slow');
			}); */
			
			$('.nav>li').hover(function(){
				$(this).children('ul').stop().slideToggle('slow');
			});
			
			
			
			
		});
	</script>
</body>

</html>